<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/base.css?v2.0.11" >
    <link rel="stylesheet" type="text/css" href="../css/mui/mui.css?v2.0.11">
    <link rel="stylesheet" type="text/css" href="../css/sctouch_member.css?v2.0.11" >
    <link rel="stylesheet" type="text/css" href="../css/index.css?v2.0.11">
    <link rel="stylesheet" type="text/css" href="../css/sctouch_common.css?v2.0.11">
</head>
<body class="pay-jump">
<div class="pay-top">
    <div class="header-wrap">
        <div class="header-l mui-action-back" ><a ><i class="back iconfont"></i></a></div>
        <div class="header-title">
            <h1>支付结果</h1>
        </div>
        <div class="header-r"> <a id="header-nav" ></a> </div>
    </div>

    <div class="pay-content">
        <div class="pay_state">
            <div class="iconfont icon">&#xe64f;</div>
            <div class="pay-text"></div>
        </div>
        <div class="mt5 pay-btn">
            <a class="goods-btn white font-sm-1 ex-open-url search-order" data-url="../member/order_detail.html">查看订单</a>
            <a class="goods-btn  white font-sm-1 ex-open-url continue" data-url="../mall/index.html" >继续逛逛</a>
            <a  class="check-payment goods-btn  white font-sm-1 payment">立即支付</a>

            <div class="sctouch-bottom-mask">
                <div class="sctouch-bottom-mask-bg"></div>
                <div class="sctouch-bottom-mask-block">
                    <div class="sctouch-bottom-mask-top">
                        <p class="sctouch-cart-num">本次交易需在线支付<em id="onlineTotal">0.00</em><lang data-id="element"></lang></p>
                        <p style="display:none" id="isPayed"></p>
                        <a class="sctouch-bottom-mask-close"><i></i></a> </div>
                    <div class="sctouch-inp-con sctouch-inp-cart">
                        <ul class="form-box" id="internalPay">
                            <p class="rpt_error_tip" style="display:none;color:red;"></p>
                            <li class="form-item" id="wrapperUseRCBpay">
                                <div class="input-box pl5">
                                    <label>
                                        <input type="checkbox" class="checkbox" id="useRCBpay" autocomplete="off" />
                                        使用充值卡支付 <span class="power"><i></i></span> </label>
                                    <p>可用充值卡余额 ￥<em id="availableRcBalance"></em></p>
                                </div>
                            </li>
                            <li class="form-item" id="wrapperUsePDpy">
                                <div class="input-box pl5">
                                    <label>
                                        <input type="checkbox" class="checkbox" id="usePDpy" autocomplete="off" />
                                        使用余额支付 <span class="power"><i></i></span> </label>
                                    <p>可用余额 ￥<em id="availablePredeposit"></em></p>
                                </div>
                            </li>
                            <li class="form-item" id="wrapperPaymentPassword" style="display:none">
                                <div class="input-box"> <span class="txt">输入支付密码</span>
                                    <input type="password" class="inp" id="paymentPassword" placeholder="默认为登录密码" autocomplete="off" />
                                    <span class="input-del"></span></div>
                                <a href="member_paypwd_step1.html"  class="input-box-help" style="display:none"><i>i</i>尚未设置</a> </li>
                        </ul>
                        <div class="sctouch-pay">
                            <div class="spacing-div"><span>在线支付方式</span></div>
                            <div class="pay-sel" id="pay-sel">
                                <script type="text/html" id="pay-sel-tmpl">
                                    <%if(payment_list.length > 0) {%>
                                    <%for(var p = 0;p < payment_list.length;p++){%>
                                    <label style="display:none">
                                        <input type="radio" name="payment_code" class="checkbox" id="<%=payment_list[p]%>" autocomplete="off" />
                                        <span class="<%=payment_list[p]%>"><%=payment_list[p]%></span></label>
                                    <%}}%>
                                </script>
                            </div>
                        </div>
                        <div class="pay-btn"> <a id="toPay" class="btn-l">确认支付</a> </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="balance-box block-area mt20">
        <div class="balance-cnt">
            <div class="row" id="address-content">
                <div class="reciver_name"><span class="name mr2"></span><span class="mobile"></span></div>
                <div class="address-info"><span class="reciver-address"></span></div>
                <div class="order-sn"><span class="mr2">订单编号：</span><span class="copy-order_sn pay-sn"></span> <span class="copy-to-clip" data-target=".copy-order_sn"><i class="iconfont">&#xe624;</i></span></div>
                <div class="order-amount"><span class="mr2">支付金额：</span><span class="pay-amount"></span></div>
            </div>
        </div>
    </div>
    <div class="mt10 recommend">
        <div class="recommend-top"><span class="slash"></span>为您推荐<span class="slash"></span></div>
        <div class="item-goods">
            <div class="goods-list recommend-list"></div>
        </div>
    </div>
</div>

<footer id="footer"></footer>
<script type="text/javascript" src="../js/mui/mui.js?v2.0.11" ></script>
<script type="text/javascript" src="../js/config.js?v2.0.11"></script><script type="text/javascript" src="../js/base64.js?v2.0.11"></script>
<script type="text/javascript" src="../js/zepto.min.js?v2.0.11" ></script>
<script type="text/javascript" src="../js/fly/zepto.fly.min.js?v2.0.11"></script>
<script type="text/javascript" src="../js/template.js?v2.0.11"></script>
<script type="text/javascript" src="../js/layer_mobile/layer.js"></script>
<script type="text/javascript" src="../js/simple-plugin.js?v2.0.11" ></script>
<script type="text/javascript" src="../js/common.js?v2.0.11" ></script>
<script type="text/javascript" src="../js/order_payment_common.js?v2.0.11" ></script>
<script type="text/javascript" src="../js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="../member/lang/order_detail.js?v2.0.11"></script>
<script type="text/javascript" src="../js/lang.js?v2.0.11" ></script>
<script type="text/html" id="goods_list">
    <% var member_type = result.member_type; %>
    <% var goods_list = result.goods_list; %>
    <% if (goods_list.length) { %>
    <% for (var i in goods_list) { %>
    <div class="item">
        <div class="block-area open-url" data-url="../mall/product_detail.html?time_goods_id=<%= goods_list[i].time_goods_id%>">
            <% if (goods_list[i].promotion_type_image) { %>
            <div class="type_icon"><img src="<%= goods_list[i].promotion_type_image %>" class="left-top"></div>
            <% } %>
            <img src="<%= goods_list[i].goods_image_url_240 %>">
            <div class="block-area block-price">
                <span class="now_price"><%= goods_list[i].goods_price %></span>
                <span class="market-price">市场价￥<%= goods_list[i].goods_marketprice %></span>
            </div>
        </div>
        <div class="intro-box">
            <p class="goods_name open-url" data-url="../mall/product_detail.html?time_goods_id=<%= goods_list[i].time_goods_id%>">
                <%if (goods_list[i].shipping_free){%>
                <span style="color: <%=goods_list[i].shipping_free_color%>;background-color: #ffffff;height:1rem;padding: 0">【<%=goods_list[i].shipping_free%>】</span>
                <%}%>
                <%= goods_list[i].goods_name %>
            </p>
        </div>
        <div class="block-area price_info">
            <div class="price-box">
                &nbsp;
                <div class="price-fixed">
                    <%if(member_type < 3){%>
                    <p class="btn-box goods-subscribe site-subscribe" data-goods_id="<%= goods_list[i].goods_id %>" data-time_goods_id="<%= goods_list[i].time_goods_id %>" <%if(goods_list[i].subscribe){%> style="display:none" <%} else{%>style="display:block" <%  } %>>

                    <span class="goods-subscribe-btn <%if(goods_list[i].is_fixed_price == 1){%>fixed_price <%}%>">
                                <%if(goods_list[i].is_fixed_price == 1){%>
                                <span >
                                        限价认购
                                    </span>
                                <%}else{%>
                                 <span>
                                        认购&nbsp;&nbsp;>
                                    </span>
                                <%}%>

                                </span>
                    </p>
                    <p class="btn-box goods-subscribe" data-goods_id="<%= goods_list[i].goods_id %>" data-time_goods_id="<%= goods_list[i].time_goods_id %>" <%if(goods_list[i].subscribe){%> style="display:block" <%} else{%>style="display:none" <%  } %>>
                    <% if (goods_list[i].is_fixed_price == 1) { %>
                    <span class="goods-subscribe-btn fixed_price">
                                    赚
                                    <span class="custom-price-profit">
                                    <%=goods_list[i].subscribe ? goods_list[i].subscribe.goods_profit_format : ''%>
                                    </span>
                                </span>
                    <%}else{%>
                    <span class="goods-btn">销售价<span class="custom-price" >
                                        <%=goods_list[i].subscribe ? goods_list[i].subscribe.goods_custom_price_format : 0%>
                                    </span>
                                </span>
                    <span class="goods-btn">
                                    赚
                                    <span class="custom-price-profit">
                                    <%=goods_list[i].subscribe ? goods_list[i].subscribe.goods_profit_format : ''%>
                                    </span>
                                </span>

                    <% } %>

                    </p>
                    <%}%>
                </div>
            </div>
            <div class="btn-box">
                <%if(member_type < 3){%>
                <a  class="goods-btn red font-sm-1 goods-subscribe <% if (goods_list[i].subscribe) { %>favorate<% } %> <% if (goods_list[i].is_fixed_price == 1) { %>fixed_price_border<% } %> " data-goods_id="<%= goods_list[i].goods_id %>" data-time_goods_id="<%= goods_list[i].time_goods_id %>" >
                    <p class="desc"><% if (goods_list[i].subscribe) { %>已认购<%} else {%>认购<% } %></p>
                </a>

                <% if (goods_list[i].time_begin >= goods_list[i].date_time && goods_list[i].date_time >= goods_list[i].time) { %>
                <span class="goods-btn red-full goods-prompt-add" data-goods_id="<%= goods_list[i].goods_id %>" data-time_goods_id="<%= goods_list[i].time_goods_id %>" data-type="2"><%=goods_list[i].on_sale_notice_format%></span>
                <% } else { %>
                <span class="goods-btn red-full iconfont add-to-cart <%if(goods_list[i].is_fixed_price == 1){%>fixed_price<%}%>" data-goods_id="<%= goods_list[i].goods_id %>" data-time_goods_id="<%= goods_list[i].time_goods_id %>">&#xe73e;</span>
                <% } %>

                <% }else{%>
                <span class="goods-btn red-full iconfont add-to-cart btn-full" data-goods_id="<%= goods_list[i].goods_id %>" data-time_goods_id="<%= goods_list[i].time_goods_id %>">&#xe73e;</span>
                <%}%>
            </div>
        </div>
    </div>
    <% } %>
    <% } %>
</script>

<script type="text/html" id="goods_list2">
    <% var member_type = result.member_type; %>
    <% var goods_list = result.goods_list; %>
    <% if (goods_list.length) { %>
    <% for (var i in goods_list) { %>
    <div class="item">
        <div class="block-area open-url" data-url="../mall/share_product_detail.html?goods_id=<%= goods_list[i].goods_id%>&inviter_id=<%=inviter_id%>">
            <% if (goods_list[i].promotion_type_image) { %>
            <div class="type_icon"><img src="<%= goods_list[i].promotion_type_image %>" class="left-top"></div>
            <% } %>
            <img src="<%= goods_list[i].goods_image_url_240 %>">
            <div class="block-area block-price">
                <span class="now_price">￥ <%= goods_list[i].goods_subscribe_price %></span>
            </div>
        </div>
        <div class="intro-box">
            <p class="goods_name open-url" data-url="../mall/share_product_detail.html?goods_id=<%= goods_list[i].goods_id%>&inviter_id=<%=inviter_id%>">
                <%if (goods_list[i].shipping_free){%>
                <span style="color: <%=goods_list[i].shipping_free_color%>;background-color: #ffffff;height:1rem;padding: 0">【<%=goods_list[i].shipping_free%>】</span>
                <%}%>
                <%= goods_list[i].goods_name %>
            </p>
        </div>
    </div>
    <% } %>
    <div class="block-area text-center"><div class="mui-col-xs-6 btn btn-default open-url" data-url="../mall/shop_portal.html" data-inviter_id="<%=inviter_id%>" style="margin-top: 1rem;">查看更多</div></div>
    <% } %>
</script>
<script>
    (function () {
        var member_type = getUserType()? getUserType(): 3;
        var goods_subscribe_id = getCookie('goods_subscribe_id');
        var inviter_id = 0;
        window.order_sn = '';
        var pay_sn = getQueryString('pay_sn');
        // 页面中转跳转
        var jumpTo = getQueryString('url') || '';
        var t = setTimeout(function () {
            // 页面跳转
            if(jumpTo) pageChange(jumpTo);
        }, 500);

        // 初始化时关闭打开页
        // plus ready
        mui.plusReady(function() {
            clearTimeout(t);
            // 关掉下单页，返回时直接到购物车
            getOpennerWindow().close();
        });

        window.pageReload = function () {
	        // 支付成功回退
	        closeCurrentWindow();
        };

        //订单详情展示
        function getOrderInfo() {
            baseApi.get('Memberorder/order_info', {
                pay_sn: pay_sn
            }, function (result) {
                var data = result.order_info.extend_order_common;
	            goods_subscribe_id = result.order_info.goods_subscribe_id;
	            inviter_id = result.order_info.inviter_id;
                window.order_sn = result.order_info.order_sn;
                window.order_qrcode = result.order_info.qrcode;
                if(result.order_info.order_type > 0 || result.order_info.commission > 0){
                    $('.pay-content .pay-btn .continue').hide();
                }
                $('.pay-content .pay-btn .payment').attr('data-pay_sn',result.order_info.pay_sn)
	            $('#address-content')
                    .find('.name').html(data.reciver_name).end()
                    .find('.mobile').html(data.reciver_mobile).end()
                    .find('.reciver-address').html(data.reciver_info.address).end()
		            .find('.pay-sn').html(result.order_info.order_sn).end()
		            .find('.pay-amount').html('<em>￥</em>'+ result.order_info.order_amount).end()
                if(goods_subscribe_id && result.order_info.order_state == 20){
                    tip();
                };

	            recommendGoods();
            });
    }

        //推荐商品
        function recommendGoods() {
            if(goods_subscribe_id){
                $.getJSON(ApiUrl + "/goods/goods_list.html", {
                    key: getCookie('key'),
                    order_sn:order_sn,
                    pagesize: 10
                }, function (data) {
                    data.result.member_type = member_type;
	                data.inviter_id = inviter_id;
                    var html = template('goods_list2', data);
                    $('.item-goods .goods-list').html(html);
                });
            }else{
                $.getJSON(ApiUrl + "/goods/goods_list.html", {
                    key: getCookie('key'),
                    promotion_type_id:1,
	                pagesize: 10
                }, function (data) {
                    console.log(data.result);
                    data.result.member_type = member_type;
                    var html = template('goods_list', data);
                    $('.item-goods .goods-list').html(html);
                });
            }
        }
        //订单付款状态
        function payStatusQuery() {
            baseApi.get('Memberbuy/pay_status', {
                pay_sn: pay_sn
            }, function (result) {
                if(isPlusReady()) {
                    // APP内显示查看订单
                    $('.continue').show();
                    $('.search-order').show();
                }
                if(result === 'success'){
                    $('.pay-jump .pay-content .pay_state')
	                    .find('.icon').html('&#xe668;').end()
	                    .find('.pay-text').html('您的订单已支付成功').end();
                    $('.pay-content .search-order').attr('data-pay_sn',pay_sn);
                }else{
	                $('.pay-content .pay_state')
		                .find('.icon').html('&#xe683;').end()
		                .find('.pay-text').html('订单未支付').end()
                    $('.pay-content .search-order').attr('data-pay_sn',pay_sn);
	                if(!isPlusReady()){
                        $('.pay-content .pay-btn .payment').show();
                    }
                   setTimeout(function () {
                        payStatusQuery();
                    }, 500);
                }
            });
        }
        $(".check-payment").on('tap',function () {
            var e = $(this).attr("data-pay_sn");
            toPay(e, "memberbuy", "pay");
            return false;
        });
        function tip() {
            layer.open({
                // content: '<div class="mui-text-left"><div>订单号:</div><div class="order-sn">'+ order_sn +'</div><div>请保存订单号以便订单追踪！</div></div>'
                content: '<img src="' + order_qrcode + '">'
                , btn: ['确定并复制订单号']
                , yes: function (index) {
                    copyOrderNO();
                    layer.close(index);
                }
            });
        }
        // 单号复制到粘贴板
        function copyOrderNO() {
            copyToClip($('.copy-order_sn').text());
        }

        getOrderInfo();
        payStatusQuery();

    }());
</script>
</body>
</html>
